package huffmanTree;

import com.google.common.collect.ImmutableList;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @author Aaron
 * @desc
 * @createTime 2022-02-25 23:30
 * @since
 */
public class Main {

    public static void main(String[] args) {
        List<String> valueLisat = ImmutableList.of("a","b","c","d","e","f","g");
        Random random = new Random();
        List<HuffmanTree<String>> huffmanTreeList =new ArrayList<>(2000);
        for (int i = 0; i < 2000; i++) {
            HuffmanTree<String> huffmanTree = new StepLockHuffumanTree<>(valueLisat.get(random.nextInt(7)));
            huffmanTreeList.add(huffmanTree);
        }
        HuffmanTree<String> huffmanTree = huffmanTreeList.get(0);
        huffmanTreeList = ImmutableList.copyOf(huffmanTreeList).subList(1,huffmanTreeList.size()-1);
        huffmanTreeList.parallelStream().forEach(x->{
            huffmanTree.addHuffmanTree(x);
        });
    }
}
